////////////////////////////////////////
// SinglyLinkedList.h

#ifndef _SINGLY_LINKED_LIST_H
#define _SINGLY_LINKED_LIST_H

template <typename T>
class SinglyLinkedList
{
private:
    class Node
    {
    public:
        T       value;
        Node    *next;
    };

    Node    *head, *tail;

public:
    SinglyLinkedList();
    int size();
    bool empty() const { return head == 0; }
    bool oneElement() const { return head->next == 0; }
    void operator=(SinglyLinkedList<T> & y);

    class iterator
    {
    public:
        iterator operator++();
        bool operator!=(const iterator & it2) const;
        T & operator*();
        Node    *ptr;
    };

    iterator begin();
    iterator end();

    T & front() { return head->value; }
    void push_front(const T & x);
    void pop_front_push_other_front(SinglyLinkedList & y);
    void append_clear_other(SinglyLinkedList & y);
};

#endif

